package com.kcral.javase.ch.properties;

import java.util.ArrayList;
import java.util.List;

/**
 * @TODO
 * @Author xu
 * 2025/3/3
 */
public class Order {
    private String orderId;                  // 订单号
    private List<Goods> goodsList;           // 货物列表

    public Order(String orderId) {
        this.orderId = orderId;
        this.goodsList = new ArrayList<>();
    }

    // 添加货物到订单
    public void addGoods(Goods goods) {
        goodsList.add(goods);
    }

    // 查看商品详情信息
    public void showGoodsDetails() {
        System.out.println("订单号: " + orderId);
        System.out.println("货物详情:");
        for (Goods goods : goodsList) {
            System.out.println(goods.showDetails());
            System.out.println();
        }
    }

    public String getOrderId() {
        return orderId;
    }
}
